package com.t2t.top.zkClient;

import org.I0Itec.zkclient.ZkClient;
import org.apache.zookeeper.CreateMode;


public class AppTest2 {

    private ZkClient zkClient;

    /**
     * 函数入口
     *
     * @param args
     */
    public static void main(String[] args) {
        AppTest2 bootStrap = new AppTest2();
        bootStrap.initialize();
    }

    /**
     * 初始化zookeeper
     */
    public void initialize() {
        String connectionString = "10.4.25.68:4180";
        int connectionTimeout = 50000;
        zkClient = new ZkClient(connectionString, connectionTimeout);
        if (!zkClient.exists("/ypf2")) {
            zkClient.create("/ypf2", new Long(System.currentTimeMillis()), CreateMode.EPHEMERAL);
        }
        System.out.println("ok");
    }

}